package com.faithbj.process;

import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import com.google.common.collect.Lists;
import org.jbpm.task.I18NText;

import java.util.List;

/**
 * User: xiongyuanwei
 * Date: 12-7-11
 * Time: 上午8:17
 */
public class TaskUtils {

    public static String getText(List<I18NText> texts) {
        List<I18NText> filtered = Lists.newArrayList(Collections2.filter(texts, new Predicate<I18NText>() {
            @Override
            public boolean apply(I18NText i18NText) {
                return i18NText.getLanguage().equals("en-UK");
            }
        }));
        if (filtered != null && !filtered.isEmpty()) {
            return filtered.get(0).getText();
        } else {
            return "";
        }
    }
}
